package com.yunlinker.asba.utils;

import android.util.Log;

/**
 * Created by mars on 2017/9/15.
 */

public class LogUtills {
    // log打印
    public static void LogShow(String tag, Object obj) {
        try {
            if (obj != null) {
                if (obj instanceof String) {
                    if (objIsNotEmpty((String) obj))
                        Log.i(tag, (String) obj);
                    else
                        Log.i(tag, "空值");
                } else if (obj instanceof Integer) {
                    Log.i(tag, "" + ((Integer) obj).intValue());
                } else if (obj instanceof Long) {
                    Log.i(tag, "" + (Long) obj);
                } else if (obj instanceof Boolean) {
                    Log.i(tag, "" + (Boolean) obj);
                }
            } else {
                Log.i(tag, "空值");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * 判断对象是否为空或者String 为""
     */
    public static boolean objIsNotEmpty(Object obj) {
        if (obj instanceof String) {
            if (obj != null && !"".equals((String) obj)) {
                return true;
            } else {
                return false;
            }
        } else {
            if (obj != null) {
                return true;
            } else {
                return false;
            }
        }
    }
}
